package com.vonchange.purchase.dr.service.impl;

import java.util.Date;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bstek.dorado.data.entity.EntityState;
import com.bstek.dorado.data.entity.EntityUtils;
import com.vonchange.purchase.dr.service.IDRMerchantService;
import com.vonchange.purchase.merchant.bean.Merchant;
import com.vonchange.purchase.merchant.dao.IMerchantDao;
import com.vonchange.purchase.sys.bean.SysDictItem;
import com.vonchange.utils.convert.ConvertUtils;
import com.vonchange.utils.crud.dao.IBaseDao;
import com.vonchange.utils.crud.service.dr.impl.DRServiceImpl;
@Service
@Transactional
public class DRMerchantServiceImpl extends DRServiceImpl<Merchant>  implements IDRMerchantService{
    @Resource
	private IMerchantDao merchantDao; 
	@Override
	public IBaseDao<Merchant> getDao() {
		// TODO Auto-generated method stub
		return merchantDao;
	}
	public void initSaveItem(Merchant bean,Object id){
		bean.setCreateTime(new Date());
		bean.setParentId(ConvertUtils.toString(id));
	}
	public void initCudItem(Merchant bean){
		if (null!=bean.getSubMerchants()) {
			updateCudDRItem(bean.getSubMerchants(), bean.getId());
		}
	}


}
